package com.heima.comment.controller.v1;

import com.heima.comment.service.CommentRepayService;
import com.heima.model.comment.dtos.CommentRepayDTO;
import com.heima.model.comment.dtos.CommentRepayLikeDTO;
import com.heima.model.comment.dtos.CommentRepaySaveDTO;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author by jojo
 * @Date 2022/3/10
 * @Description
 */
@Api(value = "回复评论关联API",tags ="回复评论关联API")
@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {
    @Autowired
    private CommentRepayService commentRepayService;

    @ApiOperation("保存回复评论")
    @PostMapping("/save")
    public ResponseResult save(@RequestBody @Validated CommentRepaySaveDTO dto){
        return commentRepayService.saveCommentRepay(dto);
    }

    @ApiOperation("保存回复评论点赞")
    @PostMapping("/like")
    public ResponseResult like(@RequestBody @Validated CommentRepayLikeDTO dto){
        return commentRepayService.likeCommentRepay(dto);
    }
    @ApiOperation("保存回复评论点赞")
    @PostMapping("/load")
    public ResponseResult load(@RequestBody @Validated CommentRepayDTO dto){
        return commentRepayService.loadCommentRepay(dto);
    }
}
